<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">


<title>在职员工列表</title>

<link rel="shortcut icon" href="favicon.ico">
<link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6"
	rel="stylesheet">
<link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0"
	rel="stylesheet">

<!-- Data Tables -->
<link
	href="__PUBLIC__/Theme1/css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">

<link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
<link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0"
	rel="stylesheet">

</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>在职员工列表</h5>
						<div class="ibox-tools">
							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
							</a> <a class="close-link"> <i class="fa fa-times"></i>
							</a>
						</div>
					</div>

					<form method="post" action="__URL__/DelAll" class="form-horizontal"
						id="form-admin-add">
						<script type="text/javascript">
                    function CheckAll(val) {
                        $("input[name='node[]']").each(function() {
                            this.checked = val;
                        });
                    }
                    </script>


						<div class="ibox-content">
							<table
								class="table table-striped table-bordered table-hover dataTables-example">

								<thead>
									<tr>
										<th></th>
										<th>编号</th>
										<th>姓名</th>
										<th>性别</th>
										<th>年龄</th>
										<th class="dropdown hidden-xs">学历</th>
                                        <th class="dropdown hidden-xs">婚姻状况</th>
										<th class="dropdown hidden-xs">电话</th>
										<th class="dropdown hidden-xs">所在部门</th>
										<th class="dropdown hidden-xs">工龄</th>
										<th class="dropdown hidden-xs">校正工龄</th>
                                        <th class="dropdown hidden-xs">级别</th>
										<th class="dropdown hidden-xs">入职表</th>
										<th class="dropdown hidden-xs">身份证</th>
										<th class="dropdown hidden-xs">操作</th>
									</tr>
								</thead>
								<tbody>
									<foreach name="rs_staffLists" item="val_staffLists">
									<tr class="text-c">
										<td><input type="checkbox" name="node[]"
											value="<{$val_staffLists.stId}>"></td>

										<td><{$val_staffLists.stNum}></td>
										<td><a href="__URL__/show/stId/<{$val_staffLists.stId}>"><{$val_staffLists.stName}></a></td>
										<if condition="$val_staffLists.stSex eq 1">
										<td>男</td>
										<else />
										<td>女</td>
										</if>
										<php> $nowTime=time();
										$stBirthdate=strtotime($val_staffLists["stBirthdate"]);
										$stAge=floor((($nowTime-$stBirthdate)/86400)/365); </php>
										<td><{$stAge}> 岁</td>

										<php> $xueliInfo="";
										$xueliId=$val_staffLists["stDegrees"];
										$variables=M("variables");
										$rs_variables=$variables->where("vId=1")->find();
										$xueli=explode("|",$rs_variables["vVariablesVal"]);
										foreach($xueli as $key=>$valxueli){ if($key==$xueliId){
										$xueliInfo=$valxueli; } } </php>
										<td class="dropdown hidden-xs"><{$xueliInfo}></td>
                                        <php> $hunyinInfo="";
										$hunyinId=$val_staffLists["stMarital"];
										$variables=M("variables");
										$rs_variables=$variables->where("vId=4")->find();
										$hunyin=explode("|",$rs_variables["vVariablesVal"]);
										foreach($hunyin as $key=>$valhunyin){ if($key==$hunyinId){
										$hunyinInfo=$valhunyin; } } </php>
										<td class="dropdown hidden-xs"><{$hunyinInfo}></td>
                                        
										<td class="dropdown hidden-xs"><{$val_staffLists.stTel}></td>
										<php> $departmentInfo=M("department");
										$rs_departmentInfo=$departmentInfo->field("dId,dPid,dPsid,dName")->where("dId={$val_staffLists['stDid']}")->find();
										</php>
										<if
											condition="$rs_departmentInfo.dPid eq 0 AND $rs_departmentInfo.dPsid eq 0">
										<td class="dropdown hidden-xs"><{$rs_departmentInfo["dName"]}></td>
										<elseif
											condition="$rs_departmentInfo.dPid neq 0 AND $rs_departmentInfo.dPsid eq 0" />
										<php> $dPid=$rs_departmentInfo["dPid"];
										$department=M("department");
										$rsp=$department->where("dId={$dPid}")->find(); </php>
										<td class="dropdown hidden-xs"><{$rsp.dName}> ->
											<{$rs_departmentInfo["dName"]}></td>
										<elseif
											condition="$rs_departmentInfo.dPid eq 0 AND $rs_departmentInfo.dPsid neq 0" />
										<php> $dPsid=$rs_departmentInfo["dPsid"];
										$department=M("department");
										$rsps=$department->where("dId={$dPsid}")->find();
										$rsPsPid=$rsps["dPid"];
										$rsPspe=$department->where("dId={$rsPsPid}")->find(); </php>
										<td class="dropdown hidden-xs"><{$rsPspe.dName}> ->
											<{$rsps.dName}> -> <{$rs_departmentInfo["dName"]}></td>

										</if>

										<php> $nowTime=time();
										$stEntryDate=strtotime($val_staffLists["stEntryDate"]);
										$quiteYear=strtotime($val_staffLists["stDepartureDate"]);
										if($quiteYear!=0){
										$nowWorkingYear=round(((($quiteYear-$stEntryDate)/86400)/365),1);
										}else{
										$nowWorkingYear=round(((($nowTime-$stEntryDate)/86400)/365),1);
										} 
                                        
                                        //校正工龄的计算
                                        //学历增加的工龄
                                        $stDegrees=$val_staffLists["stDegrees"];
                                        $xueliYear=0;
                                        if($stDegrees==4){
                                        $xueliYear=1;
                                        }elseif($stDegrees==5){
                                        $xueliYear=2;
                                        }elseif($stDegrees==6){
                                        $xueliYear=3;
                                        }elseif($stDegrees==7){
                                        $xueliYear=4;
                                        }
                                        
                                        //每月优秀员工评分在90分以上的
                                        $stId=$val_staffLists["stId"];
                                        $historyrecord_score=M("historyrecord_score");
                                      	$youxiuScoreNumber=$historyrecord_score->where("(hirsStId=$stId) AND hirsScore>=90")->count();
                                        $youxiuScoreYear=0.1*$youxiuScoreNumber;
                                        $jiaozhengGongling=$nowWorkingYear+$xueliYear+$youxiuScoreYear;
                                        
                                        //级别的处理
                                        $dengji="";
                                        if($jiaozhengGongling < 1 ){
                                        	$dengji="暂无";
                                        }elseif($jiaozhengGongling>=1 && $jiaozhengGongling < 4 ){
                                        	$dengji="A";
                                        }elseif($jiaozhengGongling>=4 && $jiaozhengGongling < 7 ){
                                        	$dengji="2 A";
                                        }elseif($jiaozhengGongling>=7 && $jiaozhengGongling < 10 ){
                                        	$dengji="3 A";
                                        }elseif($jiaozhengGongling>=10 && $jiaozhengGongling < 13 ){
                                        	$dengji="4 A";
                                        }elseif($jiaozhengGongling>=13 && $jiaozhengGongling < 17 ){
                                        	$dengji="5 A";
                                        }elseif($jiaozhengGongling>=17 && $jiaozhengGongling < 21 ){
                                        	$dengji="6 A";
                                        }elseif($jiaozhengGongling>=21){
                                        	$stPositionalTitles=$val_staffLists["stPositionalTitles"];
                                        	if($stPositionalTitles!=3){
                                            	$dengji="7 A";
                                            }else{
                                            	$dengji="6 A";
                                            }
                                        	
                                        }
                                        </php>
										<td class="dropdown hidden-xs"><{$nowWorkingYear}> 年</td>
										
										<td class="dropdown hidden-xs"><{$jiaozhengGongling}> 年</td>
                                        
                                        <td class="dropdown hidden-xs"><{$dengji}></td>
										
										<php> //附件简历表的处理
										$jianlibiaolength=strlen($val_staffLists["stEnclosure"]);
										//附件身份证表的处理
										$shenfenzhenglength=strlen($val_staffLists["stShenfenzhengImages"]);
										//附件离职表表的处理
										$lizhibiaolength=strlen($val_staffLists["stLizhiImages"]); </php>
										<if condition="$jianlibiaolength lt 10">
										<td>暂无</td>
										<else />
										<td><a
											href="__URL__/showruzhi/stId/<{$val_staffLists.stId}>">查看</a></td>
										</if>

										<if condition="$shenfenzhenglength lt 10">
										<td>暂无</td>
										<else />
										<td><a
											href="__URL__/showshenfenzheng/stId/<{$val_staffLists.stId}>">查看</a></td>
										</if>

										<td class="td-manage dropdown hidden-xs"><if
												condition="$val_staffLists.stJobState eq 1"> <a
												title="设置离职员工"
												href="__URL__/quitadd/stId/<{$val_staffLists.stId}>"><i
												class="glyphicon glyphicon-minus"
												style="margin-right: 10px;"></i></a> <else /> <a title="拉黑员工"
												href="__URL__/backlistsadd/stId/<{$val_staffLists.stId}>"><i
												class="glyphicon glyphicon-plus-sign"
												style="margin-right: 10px;"></i></a> </if> <a title="编辑员工资料"
											href="__URL__/update/stId/<{$val_staffLists.stId}>/depId/<{$depId}>"><i
												class="glyphicon glyphicon-pencil"
												style="margin-right: 10px;"></i></a> <a title="删除"
											href="__URL__/DelAction/stId/<{$val_staffLists.stId}>"><i
												class="glyphicon glyphicon-remove"></i></a></td>
									</tr>
									</foreach>
								</tbody>

							</table>
							<input type='checkbox' id='chkAll'
								onclick="CheckAll(this.checked)">全选 <input
								class="btn btn-danger" type="submit" value="删除">
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	<script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
	<script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
	<script
		src="__PUBLIC__/Theme1/js/plugins/jeditable/jquery.jeditable.js"></script>
	<script
		src="__PUBLIC__/Theme1/js/plugins/dataTables/jquery.dataTables.js"></script>
	<script
		src="__PUBLIC__/Theme1/js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
	<script>
        $(document).ready(function(){$(".dataTables-example").dataTable();var oTable=$("#editable").dataTable();oTable.$("td").editable("../example_ajax.php",{"callback":function(sValue,y){var aPos=oTable.fnGetPosition(this);oTable.fnUpdate(sValue,aPos[0],aPos[1])},"submitdata":function(value,settings){return{"row_id":this.parentNode.getAttribute("id"),"column":oTable.fnGetPosition(this)[2]}},"width":"90%","height":"100%"})});function fnClickAddRow(){$("#editable").dataTable().fnAddData(["Custom row","New row","New row","New row","New row"])};
    </script>
</body>

</html>
